package Operation;

import Book.BookList;

import java.util.Scanner;

//查找图书
public class FindBook implements IOperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("查找图书....");
        Scanner sc = new Scanner(System.in);
        int count = bookList.getUsedSize();
        System.out.println("请输入你要查找书籍的名字：");
        String name = sc.nextLine();
        for(int i = 0; i < count; i++){
            if(bookList.getBooks()[i].getName().equals(name)){
                System.out.println("查找成功：");
                System.out.println(bookList.getBooks()[i].toString());
                return;
            }
        }
        System.out.println("没找到这本书！");
    }
}
